<?php
/**
 * Data model
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 */
/**
 * Data model for table "pfile"
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 *
 * @property-read mixed Id
 * @property-read mixed Name
 * @property-read mixed Source
 * @property-read mixed Location
 * @property-read mixed HasInterfaces
 * @property-read mixed HasClasses
 * @property-read mixed FolderId
 * @property-read mixed PackageId
 */
abstract class BasePfile extends BaseRecord
{
    const TABLE_NAME = "pfile";

    public function __construct()
    {
        parent::__construct(self::TABLE_NAME);
    }

    protected function initFields()
    {
        $this->hasColumn('id', 'PA:int(3)');
        $this->hasColumn('name', 'N:varchar(255)');
        $this->hasColumn('source', 'N:text');
        $this->hasColumn('location', 'N:varchar(255)');
        $this->hasColumn('has_interfaces', 'tinyint(1)|0');
        $this->hasColumn('has_classes', 'tinyint(1)|0');
        $this->hasColumn('folder_id', 'int(3)');
        $this->hasColumn('package_id', 'int(3)');
    }

    public function initRelations()
    {
        $this->addRelation('Folder', new ORMRelationOne2One('Pfolder', 'folder_id',  'id'));
        $this->addRelation('Coverage', new ORMRelationOne2Many('CoverageLineStatus', 'id',  'file_id'));
        $this->addRelation('Phpclass', new ORMRelationOne2Many('Phpclass', 'id',  'file_id'));
        $this->addRelation('Comment', new ORMRelationMany2Many('Comment', 'pfile_id', 'CommentRefPfile', 'comment_id'));    
    }

    public function getById($id)
    {
        return parent::getById($id, 'Pfile');
    }

    public function getByParams( $params, $type = ORMRecord::ONE_RECORD, $limit = null )
    {
        return parent::getByParams( $params, $type, $limit, 'Pfile');
    }

    public function getAll( $limit = null )
    {
        return parent::getAll( $limit, 'Pfile' );
    }
}